# def mysql_config_ini():
#     import configparser
#
#     # 创建配置解析器对象
#     config = configparser.ConfigParser()
#
#     # 读取配置文件
#     config.read('douyin_ceshi.ini')
#
#     # 获取数据库配置
#     db_config = {
#         'db_type': config['database']['db_type'],
#         'host': config['database']['host'],
#         'port': config['database'].getint('port'),
#         'user': config['database']['user'],
#         'password': config['database']['password'],
#         'database': config['database']['database']
#     }
#     return db_config
"""正式"""
def mysql_config_ini():
    import configparser

    # 创建配置解析器对象
    config = configparser.ConfigParser()

    # 读取配置文件
    config.read('douyin_zhengshi.ini')

    # 获取数据库配置
    db_config = {
        'db_type': config['database']['db_type'],
        'host': config['database']['host'],
        'port': config['database'].getint('port'),
        'user': config['database']['user'],
        'password': config['database']['password'],
        'database': config['database']['database']
    }
    return db_config



#
# def redis_config_ini():
#     import configparser
#
#     # 创建配置解析器对象
#     config = configparser.ConfigParser()
#
#     # 读取配置文件
#     config.read('douyin_ceshi.ini')
#
#     # 获取数据库配置
#     db_config = {
#         'db_type': config['redis']['db_type'],
#         'host': config['redis']['host'],
#         'port': config['redis'].getint('port'),
#         'password': config['redis']['password'],
#         'database': config['redis']['database']
#     }
#     return db_config

def redis_config_ini():
    import configparser

    # 创建配置解析器对象
    config = configparser.ConfigParser()

    # 读取配置文件
    config.read('douyin_zhengshi.ini')

    # 获取数据库配置
    db_config = {
        'db_type': config['redis']['db_type'],
        'host': config['redis']['host'],
        'port': config['redis'].getint('port'),
        'password': config['redis']['password'],
        'database': config['redis']['database']
    }
    return db_config

# print(redis_config_ini())